<?php
$loader->requireOnce('includes/ManagerDashboard/PortletPatientNumber.class.php');
$loader->requireOnce('includes/ManagerDashboard/PortletPatientClass.class.php');
$loader->requireOnce('includes/ManagerDashboard/PortletPatientAge.class.php');
$loader->requireOnce('includes/ManagerDashboard/PortletRevenue.class.php');
$loader->requireOnce('ordo/Department.class.php');
/**
 * Controller Calendar actions
 */
class C_ManagerDashboard extends Controller {
	const DATE_RANGE 	= 0;
	const MIN_AGE 		= 0;
	const MAX_AGE 		= 80;
	const STEP			= 10;
//	const TITLE_TOTAL_ENCOUNTER = "Số lượt bệnh nhân trong tháng";
//	const TITLE_TOTAL_REVENUE = "Doanh thu khoa khám trong tháng";
//	const TITLE_PATIENT_CLASS = "Phân loại bệnh nhân trong tháng";
//	const TITLE_PATIENT_AGE = "Phân bổ tuổi bệnh nhân trong tháng";
	const TITLE_TOTAL_ENCOUNTER = "Examination numbers of month";
	const TITLE_TOTAL_REVENUE = "Examination Department's revenue of month";
	const TITLE_PATIENT_CLASS = "Classify patient of month";
	const TITLE_PATIENT_AGE = "Distribute patient of month by age";


    function C_ManagerDashboard ($template_mod = "general") {
        parent::Controller();
        $this->_db = $GLOBALS['frame']['adodb']['db'];   
    	if (Celini::getCurrentController() == 'ManagerDashboard') {
			$menu =& Menu::getInstance();
			$menu->currentSection = 'patient';
		}
        $this->template_mod = $template_mod;        
        $this->view->path = 'manager_dashboard';
        
    }
    
    public function actionViewDashboard() { 
		return $this->view->render('chart.html');
    }
    
    public function actionPatientNumberData() {    	
		//@localization
		$portletChart = new PortletPatientNumber(L10nHelper::_(self::TITLE_TOTAL_ENCOUNTER), self::DATE_RANGE);
		echo $portletChart->renderChart();
    }
    
	public function actionPatientClassData() {
		//@localization
		$portletChart = new PortletPatientClass(L10nHelper::_(self::TITLE_PATIENT_CLASS), self::DATE_RANGE);
		echo $portletChart->renderChart();
    }
    
	public function actionPatientAgeData() {
		//@localization
		$portletChart = new PortletPatientAge(L10nHelper::_(self::TITLE_PATIENT_AGE), self::DATE_RANGE,
			self::MIN_AGE, self::MAX_AGE, self::STEP);
		echo $portletChart->renderChart();
    }
    
	public function actionRevenueData() {
		//@localization
		$portletChart = new PortletRevenue(L10nHelper::_(self::TITLE_TOTAL_REVENUE), self::DATE_RANGE, Department::EXAMINATION_DEPT_ID);
		echo $portletChart->renderChart();
    }
}
?>